package BookCreated;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/CreateCalnums")
public class CreateCalnumns extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");
		request.setCharacterEncoding("UTF-8");	
	
		BookCalnums bookcal = new BookCalnums();
		if (! request.getParameter("calid").isEmpty()){
			 try {
				bookcal = BooksCalnumsDAO.getBookCalnums(request.getParameter("calid"));
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				bookcal = null;
				e.printStackTrace();
			}
		}
		request.setAttribute("bookcal", bookcal);
		request.getRequestDispatcher("EditCalnumsPage.jsp").forward(request,
				response);
	}

}
